package com.k12.user.service.impl;

import com.k12.user.model.entity.SysAreaProvinces;
import com.k12.user.mapper.SysAreaProvincesDao;
import com.k12.user.service.SysAreaProvincesService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;
/**
 * 省份代码库(SysAreaProvinces)表服务实现类
 *
 * @author makejava
 * @since 2025-07-28 20:53:10
 */
@Service("sysAreaProvincesService")
public class SysAreaProvincesServiceImpl implements SysAreaProvincesService {
    @Resource
    private SysAreaProvincesDao sysAreaProvincesDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SysAreaProvinces queryById(Integer id) {
        return this.sysAreaProvincesDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param sysAreaProvinces 筛选条件
     * @param pageRequest      分页对象
     * @return 查询结果
     */
    @Override
    public List<SysAreaProvinces> queryByPage(SysAreaProvinces sysAreaProvinces) {
        return this.sysAreaProvincesDao.queryAllByLimit(sysAreaProvinces);
    }

    /**
     * 新增数据
     *
     * @param sysAreaProvinces 实例对象
     * @return 实例对象
     */
    @Override
    public SysAreaProvinces insert(SysAreaProvinces sysAreaProvinces) {
        this.sysAreaProvincesDao.insert(sysAreaProvinces);
        return sysAreaProvinces;
    }

    /**
     * 修改数据
     *
     * @param sysAreaProvinces 实例对象
     * @return 实例对象
     */
    @Override
    public SysAreaProvinces update(SysAreaProvinces sysAreaProvinces) {
        this.sysAreaProvincesDao.update(sysAreaProvinces);
        return this.queryById(sysAreaProvinces.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sysAreaProvincesDao.deleteById(id) > 0;
    }
}
